using System;
using System.Collections;
using System.Xml;
using InfoJetSoft.Service.Entity;
using InfoJetSoft.Service.Util;

namespace InfoJetSoft.Service.Util
{
	/// <summary>
	/// Summary description for FileAttachmentFindWorker.
	/// </summary>
	public class FileAttachmentFinder
	{
		
		public static ArrayList findFileAttachmentList( Form form )
		{
			ArrayList fileList = new ArrayList();

			ArrayList xmlToEditList = form.Manifest.XmlToEditList;
			foreach( XmlToEdit xmlToEdit in xmlToEditList )
			{
				if( xmlToEdit.Component.Equals( JetConstant.CMP_xFileAttachment ) )
				{
					XmlNodeList fileNodeList = DOMUtil.selectNodes( form.XmlDoc.DocumentElement, xmlToEdit.Item, 0, form.XmlNsResolver );
					foreach( XmlNode fileNode in fileNodeList )
					{
						InfoJetFileAttachment fileAttachment = new InfoJetFileAttachment( form, fileNode );
						fileList.Add( fileAttachment );
					}
				}
			}

			return fileList;
		}

	}
}
